#!/usr/bin/python3.4
# -*- coding=utf-8 -*-
import os
import pg8000
import sys
import datetime

def selfresults(yourname):
#    yourname = input('请输入你的姓名: ')
	os.system('clear')
#	print("select name from seclab where name = '%s'" % yourname)
	conn = pg8000.connect(host='172.17.100.228', user='XXX', password='XXXX', database='secdb')
	cursor = conn.cursor()
	cursor.execute("select * from seclab where name = '%s'" % str(yourname))
	yourresults = cursor.fetchall()
	if yourresults == ():
		print('不好意思没有找到与您相关的记录')
		os._exit(0)
	cursor.execute("select score from seclab")
	total_score_results = cursor.fetchall()

#	计算平均得分
	your_total_score = 0
	your_labwork_count = 0
	for lst in yourresults:
		your_labwork_count = your_labwork_count + 1
		your_total_score = your_total_score + lst[7]
	your_average_score = your_total_score /your_labwork_count

	total_score = 0
	total_labwork_count = 0
	for lst in total_score_results:
		total_labwork_count = total_labwork_count + 1
		total_score = total_score + lst[0]
	total_average_score = total_score / total_labwork_count	
	print('您的姓名: ' + yourname)
	print('您的平均得分: ' + str(int(your_average_score)) + ' '*5 + 'ALL平均得分: ' +  str(int(total_average_score)))
	print('教主的建议:如果你的分数低于80分(B)，你正位于危险的边缘，需要更加努力了！！！')
	print('-' * 84)
	cursor.execute("select verno,result from seclab where name = '%s'" % yourname)
	your_verion_result = cursor.fetchall()
	VE_count = 0;VF_count = 0;V10_count = 0;V11_count = 0;V12_count = 0
	VE_A=0;VE_A_=0;VE_B_Plus=0;VE_B=0;VE_B_=0;VE_C_Plus=0;VE_C=0;VE_C_=0;VE_D_Plus=0;VE_D=0;VE_D_=0;VE_E_Plus=0;VE_E=0;VE_E_=0
	VF_A=0;VF_A_=0;VF_B_Plus=0;VF_B=0;VF_B_=0;VF_C_Plus=0;VF_C=0;VF_C_=0;VF_D_Plus=0;VF_D=0;VF_D_=0;VF_E_Plus=0;VF_E=0;VF_E_=0
	V10_A=0;V10_A_=0;V10_B_Plus=0;V10_B=0;V10_B_=0;V10_C_Plus=0;V10_C=0;V10_C_=0;V10_D_Plus=0;V10_D=0;V10_D_=0;V10_E_Plus=0;V10_E=0;V10_E_=0
	V11_A=0;V11_A_=0;V11_B_Plus=0;V11_B=0;V11_B_=0;V11_C_Plus=0;V11_C=0;V11_C_=0;V11_D_Plus=0;V11_D=0;V11_D_=0;V11_E_Plus=0;V11_E=0;V11_E_=0
	V12_A=0;V12_A_=0;V12_B_Plus=0;V12_B=0;V12_B_=0;V12_C_Plus=0;V12_C=0;V12_C_=0;V12_D_Plus=0;V12_D=0;V12_D_=0;V12_E_Plus=0;V12_E=0;V12_E_=0

	for verion_result in your_verion_result:
		if verion_result[0] == 've':
			VE_count = VE_count + 1
		if verion_result[0] == 've' and (verion_result[1] == 'A' or verion_result[1] == 'a'):
			VE_A = VE_A + 1
		if verion_result[0] == 've' and (verion_result[1] == 'A-' or verion_result[1] == 'a-'):
			VE_A_ = VE_A_ + 1
		if verion_result[0] == 've' and (verion_result[1] == 'B+' or verion_result[1] == 'b+'):
			VE_B_Plus = VE_B_Plus + 1
		if verion_result[0] == 've' and (verion_result[1] == 'B' or verion_result[1] == 'b'):
			VE_B = VE_B + 1
		if verion_result[0] == 've' and (verion_result[1] == 'B-' or verion_result[1] == 'b-'):
			VE_B_ = VE_B_ + 1
		if verion_result[0] == 've' and (verion_result[1] == 'C+' or verion_result[1] == 'c+'):
			VE_C_Plus = VE_C_Plus + 1
		if verion_result[0] == 've' and (verion_result[1] == 'C' or verion_result[1] == 'c'):
			VE_C = VE_C + 1
		if verion_result[0] == 've' and (verion_result[1] == 'C-' or verion_result[1] == 'c-'):
			VE_C_ = VE_C_ + 1
		if verion_result[0] == 've' and (verion_result[1] == 'D+' or verion_result[1] == 'd+'):
			VE_D_Plus = VE_D_Plus + 1
		if verion_result[0] == 've' and (verion_result[1] == 'D' or verion_result[1] == 'd'):
			VE_D = VE_D + 1
		if verion_result[0] == 've' and (verion_result[1] == 'D-' or verion_result[1] == 'd-'):
			VE_D_ = VE_D_ + 1
		if verion_result[0] == 've' and (verion_result[1] == 'E+' or verion_result[1] == 'e+'):
			VE_E_Plus = VE_E_Plus + 1
		if verion_result[0] == 've' and (verion_result[1] == 'E' or verion_result[1] == 'e'):
			VE_E = VE_E + 1
		if verion_result[0] == 've' and (verion_result[1] == 'E-' or verion_result[1] == 'e-'):
			VE_E_ = VE_E_ + 1
####################################################################################################
		if verion_result[0] == 'vf':
			VF_count = VF_count + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'A' or verion_result[1] == 'a'):
			VF_A = VF_A + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'A-' or verion_result[1] == 'a-'):
			VF_A_ = VF_A_ + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'B+' or verion_result[1] == 'b+'):
			VF_B_Plus = VF_B_Plus + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'B' or verion_result[1] == 'b'):
			VF_B = VF_B + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'B-' or verion_result[1] == 'b-'):
			VF_B_ = VF_B_ + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'C+' or verion_result[1] == 'c+'):
			VF_C_Plus = VF_C_Plus + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'C' or verion_result[1] == 'c'):
			VF_C = VF_C + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'C-' or verion_result[1] == 'c-'):
			VF_C_ = VF_C_ + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'D+' or verion_result[1] == 'd+'):
			VF_D_Plus = VF_D_Plus + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'D' or verion_result[1] == 'd'):
			VF_D = VF_D + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'D-' or verion_result[1] == 'd-'):
			VF_D_ = VF_D_ + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'E+' or verion_result[1] == 'e+'):
			VF_E_Plus = VF_E_Plus + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'E' or verion_result[1] == 'e'):
			VF_E = VF_E + 1
		if verion_result[0] == 'vf' and (verion_result[1] == 'E-' or verion_result[1] == 'e-'):
			VF_E_ = VF_E_ + 1
####################################################################################################			
		if verion_result[0] == 'v10':
			V10_count = V10_count + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'A' or verion_result[1] == 'a'):
			V10_A = V10_A + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'A-' or verion_result[1] == 'a-'):
			V10_A_ = V10_A_ + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'B+' or verion_result[1] == 'b+'):
			V10_B_Plus = V10_B_Plus + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'B' or verion_result[1] == 'b'):
			V10_B = V10_B + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'B-' or verion_result[1] == 'b-'):
			V10_B_ = V10_B_ + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'C+' or verion_result[1] == 'c+'):
			V10_C_Plus = V10_C_Plus + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'C' or verion_result[1] == 'c'):
			V10_C = V10_C + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'C-' or verion_result[1] == 'c-'):
			V10_C_ = V10_C_ + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'D+' or verion_result[1] == 'd+'):
			V10_D_Plus = V10_D_Plus + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'D' or verion_result[1] == 'd'):
			V10_D = V10_D + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'D-' or verion_result[1] == 'd-'):
			V10_D_ = V10_D_ + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'E+' or verion_result[1] == 'e+'):
			V10_E_Plus = V10_E_Plus + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'E' or verion_result[1] == 'e'):
			V10_E = V10_E + 1
		if verion_result[0] == 'v10' and (verion_result[1] == 'E-' or verion_result[1] == 'e-'):
			V10_E_ = V10_E_ + 1
####################################################################################################
		if verion_result[0] == 'v11':
			V11_count = V11_count + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'A' or verion_result[1] == 'a'):
			V11_A = V11_A + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'A-' or verion_result[1] == 'a-'):
			V11_A_ = V11_A_ + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'B+' or verion_result[1] == 'b+'):
			V11_B_Plus = V11_B_Plus + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'B' or verion_result[1] == 'b'):
			V11_B = V11_B + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'B-' or verion_result[1] == 'b-'):
			V11_B_ = V11_B_ + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'C+' or verion_result[1] == 'c+'):
			V11_C_Plus = V11_C_Plus + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'C' or verion_result[1] == 'c'):
			V11_C = V11_C + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'C-' or verion_result[1] == 'c-'):
			V11_C_ = V11_C_ + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'D+' or verion_result[1] == 'd+'):
			V11_D_Plus = V11_D_Plus + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'D' or verion_result[1] == 'd'):
			V11_D = V11_D + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'D-' or verion_result[1] == 'd-'):
			V11_D_ = V11_D_ + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'E+' or verion_result[1] == 'e+'):
			V11_E_Plus = V11_E_Plus + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'E' or verion_result[1] == 'e'):
			V11_E = V11_E + 1
		if verion_result[0] == 'v11' and (verion_result[1] == 'E-' or verion_result[1] == 'e-'):
			V11_E_ = V11_E_ + 1
####################################################################################################
		if verion_result[0] == 'v12':
			V12_count = V12_count + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'A' or verion_result[1] == 'a'):
			V12_A = V12_A + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'A-' or verion_result[1] == 'a-'):
			V12_A_ = V12_A_ + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'B+' or verion_result[1] == 'b+'):
			V12_B_Plus = V12_B_Plus + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'B' or verion_result[1] == 'b'):
			V12_B = V12_B + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'B-' or verion_result[1] == 'b-'):
			V12_B_ = V12_B_ + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'C+' or verion_result[1] == 'c+'):
			V12_C_Plus = V12_C_Plus + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'C' or verion_result[1] == 'c'):
			V12_C = V12_C + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'C-' or verion_result[1] == 'c-'):
			V12_C_ = V12_C_ + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'D+' or verion_result[1] == 'd+'):
			V12_D_Plus = V12_D_Plus + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'D' or verion_result[1] == 'd'):
			V12_D = V12_D + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'D-' or verion_result[1] == 'd-'):
			V12_D_ = V12_D_ + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'E+' or verion_result[1] == 'e+'):
			V12_E_Plus = V12_E_Plus + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'E' or verion_result[1] == 'e'):
			V12_E = V12_E + 1
		if verion_result[0] == 'v12' and (verion_result[1] == 'E-' or verion_result[1] == 'e-'):
			V12_E_ = V12_E_ + 1

####################################################################################################
	print('  VE作业数量:  ' + str(VE_count), end = '|')
	print('A:' + '(' + str(VE_A) + ')', end = '|')
	print('A-:' + '(' + str(VE_A_) + ')', end = '|')
	print('B+:' + '(' + str(VE_B_Plus) + ')', end = '|')
	print('B:' + '(' + str(VE_B) + ')', end = '|')
	print('B-:' + '(' + str(VE_B_) + ')', end = '|')
	print('C+:' + '(' + str(VE_C_Plus) + ')', end = '|')
	print('C:' + '(' + str(VE_C) + ')', end = '|')
	print('C-:' + '(' + str(VE_C_) + ')', end = '|')
	print('D+:' + '(' + str(VE_D_Plus) + ')', end = '|')
	print('D:' + '(' + str(VE_D) + ')')
#	print('D-:' + '(' + str(VE_D_) + ')', end = '|')
#	print('E+:' + '(' + str(VE_E_Plus) + ')', end = '|')
#	print('E:' + '(' + str(VE_E) + ')', end = '|')
#	print('E-:' + '(' + str(VE_E_) + ')')
####################################################################################################
	print('  VF作业数量:  ' + str(VF_count), end = '|')
	print('A:' + '(' + str(VF_A) + ')', end = '|')
	print('A-:' + '(' + str(VF_A_) + ')', end = '|')
	print('B+:' + '(' + str(VF_B_Plus) + ')', end = '|')
	print('B:' + '(' + str(VF_B) + ')', end = '|')
	print('B-:' + '(' + str(VF_B_) + ')', end = '|')
	print('C+:' + '(' + str(VF_C_Plus) + ')', end = '|')
	print('C:' + '(' + str(VF_C) + ')', end = '|')
	print('C-:' + '(' + str(VF_C_) + ')', end = '|')
	print('D+:' + '(' + str(VF_D_Plus) + ')', end = '|')
	print('D:' + '(' + str(VF_D) + ')')
#	print('D-:' + '(' + str(VF_D_) + ')', end = '|')
#	print('E+:' + '(' + str(VF_E_Plus) + ')', end = '|')
#	print('E:' + '(' + str(VF_E) + ')', end = '|')
#	print('E-:' + '(' + str(VF_E_) + ')')
####################################################################################################
	print('  V10作业数量: ' + str(V10_count), end = '|')
	print('A:' + '(' + str(V10_A) + ')', end = '|')
	print('A-:' + '(' + str(V10_A_) + ')', end = '|')
	print('B+:' + '(' + str(V10_B_Plus) + ')', end = '|')
	print('B:' + '(' + str(V10_B) + ')', end = '|')
	print('B-:' + '(' + str(V10_B_) + ')', end = '|')
	print('C+:' + '(' + str(V10_C_Plus) + ')', end = '|')
	print('C:' + '(' + str(V10_C) + ')', end = '|')
	print('C-:' + '(' + str(V10_C_) + ')', end = '|')
	print('D+:' + '(' + str(V10_D_Plus) + ')', end = '|')
	print('D:' + '(' + str(V10_D) + ')')
#	print('D-:' + '(' + str(V10_D_) + ')', end = '|')
#	print('E+:' + '(' + str(V10_E_Plus) + ')', end = '|')
#	print('E:' + '(' + str(V10_E) + ')', end = '|')
#	print('E-:' + '(' + str(V10_E_) + ')')
####################################################################################################
	print('  V11作业数量: ' + str(V11_count), end = '|')
	print('A:' + '(' + str(V11_A) + ')', end = '|')
	print('A-:' + '(' + str(V11_A_) + ')', end = '|')
	print('B+:' + '(' + str(V11_B_Plus) + ')', end = '|')
	print('B:' + '(' + str(V11_B) + ')', end = '|')
	print('B-:' + '(' + str(V11_B_) + ')', end = '|')
	print('C+:' + '(' + str(V11_C_Plus) + ')', end = '|')
	print('C:' + '(' + str(V11_C) + ')', end = '|')
	print('C-:' + '(' + str(V11_C_) + ')', end = '|')
	print('D+:' + '(' + str(V11_D_Plus) + ')', end = '|')
	print('D:' + '(' + str(V11_D) + ')')
#	print('D-:' + '(' + str(V11_D_) + ')', end = '|')
#	print('E+:' + '(' + str(V11_E_Plus) + ')', end = '|')
#	print('E:' + '(' + str(V11_E) + ')', end = '|')
#	print('E-:' + '(' + str(V11_E_) + ')')
####################################################################################################
	print('  V12作业数量: ' + str(V12_count), end = '|')
	print('A:' + '(' + str(V12_A) + ')', end = '|')
	print('A-:' + '(' + str(V12_A_) + ')', end = '|')
	print('B+:' + '(' + str(V12_B_Plus) + ')', end = '|')
	print('B:' + '(' + str(V12_B) + ')', end = '|')
	print('B-:' + '(' + str(V12_B_) + ')', end = '|')
	print('C+:' + '(' + str(V12_C_Plus) + ')', end = '|')
	print('C:' + '(' + str(V12_C) + ')', end = '|')
	print('C-:' + '(' + str(V12_C_) + ')', end = '|')
	print('D+:' + '(' + str(V12_D_Plus) + ')', end = '|')
	print('D:' + '(' + str(V12_D) + ')')
#	print('D-:' + '(' + str(V12_D_) + ')', end = '|')
#	print('E+:' + '(' + str(V12_E_Plus) + ')', end = '|')
#	print('E:' + '(' + str(V12_E) + ')', end = '|')
#	print('E-:' + '(' + str(V12_E_) + ')')
####################################################################################################
	print('-' * 84)
	print('  作业总数量:  ' + str(your_labwork_count), end = '|')
	print('A:' + '(' + str(VE_A + VF_A + V10_A + V11_A + V12_A) + ')', end = '|')
	print('A-:' + '(' + str(VE_A_ + VF_A_ + V10_A_ + V11_A_ + V12_A_) + ')', end = '|')
	print('B+:' + '(' + str(VE_B_Plus + VF_B_Plus + V10_B_Plus + V11_B_Plus + V12_B_Plus) + ')', end = '|')
	print('B:' + '(' + str(VE_B + VF_B + V10_B + V11_B + V12_B) + ')', end = '|')
	print('B-:' + '(' + str(VE_B_ + VF_B_ + V10_B_ + V11_B_ + V12_B_) + ')', end = '|')
	print('C+:' + '(' + str(VE_C_Plus + VF_C_Plus + V10_C_Plus + V11_C_Plus + V12_C_Plus) + ')', end = '|')
	print('C:' + '(' + str(VE_C + VF_C + V10_C + V11_C + V12_C) + ')', end = '|')
	print('C-:' + '(' + str(VE_C_ + VF_C_ + V10_C_ + V11_C_ + V12_C_) + ')', end = '|')
	print('D+:' + '(' + str(VE_D_Plus + VF_D_Plus + V10_D_Plus + V11_D_Plus + V12_D_Plus) + ')', end = '|')
	print('D:' + '(' + str(VE_D + VF_D + V10_D + V11_D + V12_D) + ')')
#	print('D-:' + '(' + str(V12_D_) + ')', end = '|')
#	print('E+:' + '(' + str(V12_E_Plus) + ')', end = '|')
#	print('E:' + '(' + str(V12_E) + ')', end = '|')
#	print('E-:' + '(' + str(V12_E_) + ')')
	print('教主的建议:交作业的数量至少超过25份，如果低于这个数量，你就应该更加努力的敲版本！')
####################################################################################################
	print('-' * 84)

	cursor.execute("select date,hour from seclab where name = '%s' order by date" % yourname)
	your_time_result = cursor.fetchall()
	dates = []
	hours = []
	for dates_and_hours in your_time_result:
		dates.append(dates_and_hours[0])
		hours.append(dates_and_hours[1])
#	print(dates)
#	print(hours)

#	for dates_and_hours in your_time_result:
#		date = str(dates_and_hours[0]).split('-')
#		inttime = int(date[0])*1000000 + int(date[1])*10000 + int(date[2])*100 + dates_and_hours[1] 
#	times.append(str(inttime))
#	times.sort()
#	print("您第一次上交作业的时间是: " + times[0][0:4] + "年 " + times[0][4:6] + "月 " + times[0][6:8] + "日 " +  times[0][8:10] + "时")
#	print("您最近一次上交作业时间是: " + times[0][0:4] + "年 " + times[0][4:6] + "月 " + times[0][6:8] + "日 " +  times[0][8:10] + "时")

	print("  您第一次上交作业的时间是        : " + str(dates[0]) + ' ' + str(hours[0]))
	print("  您最近一次上交作业时间是        : " + str(dates[-1]) + ' ' + str(hours[-1]))
#	print(type(datetime.date.today()))
#	print(type(dates[0]))
#	print(datetime.date.today() - dates[0])
#	print(str(datetime.date.today() - dates[0]).split(',')[0])
	print("  从第一次上交作业到今天已经过去  : " + str(datetime.date.today() - dates[0]).split(',')[0][:-3] + '天')
	day_to_passed = int(str(datetime.date.today() - dates[0]).split(',')[0][:-3])
	week_to_passwd = day_to_passed / 7
	week_lab_work = str(int(your_labwork_count / week_to_passwd))
	print("  您平均一个星期上交作业数为      : " + week_lab_work + " 份")
	print('教主的建议:每一个星期平均至少交5分作业')
	searchvalues = "r1,r2,r3,r4,r5,r6,asa1,asa1sys,asa1admin,asa1c1,asa1c2,asa2,asa2sys,asa2admin,asa2c1,asa2c2,asa3,asa3sys,asa3admin,asa3c1,asa3c2,asa4,asa4sys,asa4admin,asa4c1,asa4c2,sw1,sw2,sw3,sw4,sw5,sw6,ips"
	defaultcountlist = []
	searchlist = searchvalues.split(',')

#	print(searchlist)
#	print(len(defaultcountlist))
###############处理VE#####################
	print('='*29 + "每版本配置错误所在设备统计" + '='*29)
	print('教主的建议:可以通过这个部分看看你容易犯错的设备！！！')
	defaultcountlist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
#	print(defaultcountlist)
	print('VE设备错误数:')
	cursor.execute("select %s from seclab where name = '%s' and verno = 've'" % (searchvalues,yourname))
	yourresults = cursor.fetchall()
	for error_configs in yourresults:
		location = 0
		for error_config in error_configs:
			if error_config != None:
				defaultcountlist[location] = defaultcountlist[location] + 1
			location = location + 1
	
	count_location = 0
	for i in defaultcountlist:
		if i != 0:
			print("|" + searchlist[count_location]+":(" + str(i) +")", end = '')
		count_location = count_location + 1
	print()
###############处理VF#####################
	defaultcountlist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

	print('VF设备错误数:')
	cursor.execute("select %s from seclab where name = '%s' and verno = 'vf'" % (searchvalues,yourname))
	yourresults = cursor.fetchall()
	for error_configs in yourresults:
		location = 0
		for error_config in error_configs:
			if error_config != None:
				defaultcountlist[location] = defaultcountlist[location] + 1
			location = location + 1
	
	count_location = 0
	for i in defaultcountlist:
		if i != 0:
			print("|" + searchlist[count_location]+":(" + str(i) +")", end = '')
		count_location = count_location + 1
	print()
###############处理V10#####################
	defaultcountlist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

	print('V10设备错误数:')
	cursor.execute("select %s from seclab where name = '%s' and verno = 'v10'" % (searchvalues,yourname))
	yourresults = cursor.fetchall()
	for error_configs in yourresults:
		location = 0
		for error_config in error_configs:
			if error_config != None:
				defaultcountlist[location] = defaultcountlist[location] + 1
			location = location + 1
	
	count_location = 0
	for i in defaultcountlist:
		if i != 0:
			print("|" + searchlist[count_location]+":(" + str(i) +")", end = '')
		count_location = count_location + 1
	print()
###############处理V11#####################
	defaultcountlist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

	print('V11设备错误数:')
	cursor.execute("select %s from seclab where name = '%s' and verno = 'v11'" % (searchvalues,yourname))
	yourresults = cursor.fetchall()
	for error_configs in yourresults:
		location = 0
		for error_config in error_configs:
			if error_config != None:
				defaultcountlist[location] = defaultcountlist[location] + 1
			location = location + 1
	
	count_location = 0
	for i in defaultcountlist:
		if i != 0:
			print("|" + searchlist[count_location]+":(" + str(i) +")", end = '')
		count_location = count_location + 1
	print()
###############处理V12#####################
	defaultcountlist = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]

	print('V12设备错误数:')
	cursor.execute("select %s from seclab where name = '%s' and verno = 'v12'" % (searchvalues,yourname))
	yourresults = cursor.fetchall()
	for error_configs in yourresults:
		location = 0
		for error_config in error_configs:
			if error_config != None:
				defaultcountlist[location] = defaultcountlist[location] + 1
			location = location + 1
	
	count_location = 0
	for i in defaultcountlist:
		if i != 0:
			print("|" + searchlist[count_location]+":(" + str(i) +")", end = '')
		count_location = count_location + 1
	print()
	print('QYTANG' + 'Pass'*18 + 'QYTANG')



if __name__ == '__main__':
	yourname = input('请输入你中文姓名（非英文用户名）: ')
	selfresults(yourname)